package com.ruoyi.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.business.domain.MobileHomepage;
import com.ruoyi.business.service.IMobileHomepageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 首页设置Controller
 * 
 * @author ruoyi
 * @date 2024-06-13
 */
@RestController
@RequestMapping("/mobile/homepage")
public class MobileHomepageController extends BaseController {

    @Autowired
    private IMobileHomepageService homepageService;

    /**
     * @Author liumaotong
     * @Description 获取首页信息
     * @Date 2024/6/19
     * @Param []
     * @return com.ruoyi.common.core.domain.AjaxResult
     */
    @RequestMapping("/getHomePage")
    public AjaxResult getHomePage(@RequestBody MobileHomepage mobileHomepage){
        return AjaxResult.success(homepageService.getHomePage(mobileHomepage));
    }

    /**
     * @Author liumaotong
     * @Description 保存配置
     * @Date 2024/6/19
     * @Param [mobileHomepage]
     * @return com.ruoyi.common.core.domain.AjaxResult
     */
    @RequestMapping("/save")
    public AjaxResult save(@RequestBody MobileHomepage mobileHomepage){
        homepageService.saveOrUpdate(mobileHomepage);
        return AjaxResult.success();
    }

}
